﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;

namespace WebApp.Handler
{
    /// <summary>
    /// Summary description for wxHandler
    /// </summary>
    public class wxHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string token = ConfigurationManager.AppSettings["token"];
            if (string.IsNullOrEmpty(token))
            {
                return;
            }

            string echoString = context.Request.QueryString["echoStr"];
            string signature = context.Request.QueryString["signature"];
            string timestamp = context.Request.QueryString["timestamp"];
            string nonce = context.Request.QueryString["nonce"];

            if (!string.IsNullOrEmpty(echoString))
            {
                context.Response.Write(echoString);
            }
            context.Response.Write("error");
            context.Response.End();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}